<template>
  <div>

    <Head v-if="isShow" />
    <router-view></router-view>
    <Footer v-if="isShow" />
  </div>
</template>

<script setup>
import Head from '@/components/Head.vue';
import Footer from '@/components/Footer.vue';
import { useRouter } from 'vue-router';
import { ref } from 'vue';

const isShow = ref(true)
const router = useRouter()
// 某些页面是不需要head的
const whiteList = ['/login', '/register']
router.beforeEach((to, from, next) => {
  if (whiteList.includes(to.path)) {
    isShow.value = false
    next()
  } else {
    isShow.value = true
    next()
  }
})

</script>

<style lang="less" scoped></style>